import QtQuick 2.0
import QtQuick.Controls 2.3
import MyUIPlugin 1.0

Button {
    id: control
    text: "Button"
    width: 100
    height: 50

    property string style: "default"
    property string zborderColor: styles[style].borderColor

    property var styles: {
        "default":{
            "bgColor":"#fff",
            "borderColor":ThemePlugin.primaryColor,
            "fontColor":ThemePlugin.primaryColor
        },
        "success":{
            "bgColor":"#fff",
            "borderColor":"#5cb85c",
            "fontColor":"#5cb85c"
        },
        "warning":{
            "bgColor":"#fff",
            "borderColor":"#f0ad4e",
            "fontColor":"#f0ad4e"
        },
        "error":{
            "bgColor":"#fff",
            "borderColor":"#d9534f",
            "fontColor":"#d9534f"
        }
    }

    background: Rectangle {
        id: backgroundItem
        implicitWidth: ThemePlugin.buttonWidth
        implicitHeight: ThemePlugin.buttonHeight
        opacity: enabled ? 1 : 0.3
        color: control.hovered ? (control.pressed ? Qt.darker(zfontColor, 1.1) : zfontColor) : zbgColor
        border.color: zborderColor
        border.width: 1
        radius: ThemePlugin.radius
        Behavior on color { ColorAnimation {duration: 100} }
    }

}
